use TestHelper;
use EntityTest;
use EntityBagTestHelper;
use MapManager;
use Map;

sub testRegistering{
    my $mgr = shift;
    my $map = shift;
    my $key = shift;

    print "Probando registracion de mapa\n";
    $mgr->registerMap($map, $key);

    my $mapfrommgr = $mgr->getMap($key);

    if($mapfrommgr ne $map){
	print "--->ERROR: Los objetos son distintos: Registrado: ".$mapfrommgr."; original: ".$map."\n";
    }else{
	print "    Registracion OK\n";
    }
    
}


sub testUnregistering{
    my $mgr = shift;
    my $map = shift;
    my $key = shift;

    print "Probando liberacion de mapa\n";
    my $mapfrommgr = $mgr->unregisterMap($key);

    if($mapfrommgr ne $map){
	print "--->ERROR: Los objetos son distintos: Registrado{$key}: ".$mapfrommgr."; original: ".$map."\n";
    }else{
	print "    Devuelto OK\n";
    }

    my $frommgr = $mgr->getMap($key);
    if(defined($frommgr)){
	print "--->ERROR: Sigue registrado{$key}: ".$frommgr."\n";
    }else{
	print "    Liberacion OK\n";
    }

}

sub testSelecting{
    my $mgr = shift;
    my $map = shift;

    print "Probando seleccion del mapa\n";
    $selected = $mgr->selected;
    if($map eq $selected){
	print "    OK\n";
    }else{
	print "--->ERROR: ".$map." != ".$selected."\n";
    }
}

1;
